'use strict';
module.exports = {
	/**
	 * XXXnameXXX
	 * @url admin/pages/kh/dsjzxgl/dsjfjgl/batch_edit_price 前端调用的url参数地址
	 * data 请求参数
	 * @param {String} params1  参数1
	 */
	main: async (event) => {
		let { data = {}, userInfo, util, filterResponse, originalParam } = event;
		let { customUtil, uniID, config, pubFun, vk, db, _ } = util;
		let { uid, msgs, newprice } = data;
		let res = { code: 0, msg: "" };
		// 业务逻辑开始-----------------------------------------------------------

		let batchRunRes = await vk.pubfn.batchRun({
			// 主执行函数
			main: async (item, index) => {
				await vk.pubfn.sleep((Math.floor(Math.random() * (3 - 0)) + 0) * 100);
				const edits = await db.collection('a_tv_series').doc(item._id).update({
					pay: newprice
				})
				return {
					code: 0,
					index
				}
			},
			// 最大并发量，如果设置为1，则会按顺序执行
			concurrency: 100,
			// 数据源，这些数据会依次跑一遍main函数
			data: msgs
		});



		// 业务逻辑结束-----------------------------------------------------------
		return res;
	}
}
